/*
 *  SPAGL Copyright (C) 2008 Sam Pottinger
 *  This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser 
 *  General Public License as published by the Free Software Foundation; either version 2.1 of the License, or 
 *  (at your option) any later version. This library is distributed in the hope that it will be useful, but 
 *  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
 *  See the GNU Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public License along with this library; if not, 
 *  write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
 */

package spagswt;

import org.eclipse.swt.widgets.Event;
import spagcore.SpaglCoreEvent;

/**
 * An factory-like object for abstract use of various events as part of the
 * Spagl event system for SWT
 * @author Sam Pottinger
 */
public class SpaglEvent implements SpaglCoreEvent {
	
	Event targetEvent;
	int eventType;
	Object sourceObject;

	/**
	 * The contstructor called for an Event
	 * @param e the SWT native Event
	 * @param newEventType the integer representation of the Event's type
	 * @see Event
	 */
	public SpaglEvent(Event e, int newEventType)
	{
		targetEvent = e;
		sourceObject = e.widget;
		eventType = newEventType;
	}
	
	/**
	 * Return the specific event represented by this wrapper
	 */
	public Object getEvent()
	{
		return targetEvent;
	}
	
	/**
	 * Get the integer representation for the event being wrapped
	 */
	public int getEventType()
	{
		return eventType;
	}
	
	/**
	 * Get the object that called/generated the event
	 */
	public Object getSourceObject()
	{
		return sourceObject;
	}

}
